<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .box1{
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="box1">
        事件对象
    </div>
</body>
<script>
    var div=document.getElementsByClassName('box1')[0];
    div.onlick=function(e){
        console.log(e);
        console.log(window.event);

        //浏览器兼容
        e=e||window.event;
        console.log(e.name);
    }

</script>
</html>